Skip to content

Conversation

@Niloth-p
Copy link
Contributor

@Niloth-p Niloth-p commented Jul 8, 2025

Mercurial: Format the user name to hide the user's email in the summary line of the message.
Motivation: Updating example screenshots in integration docs.


Mercurial's ctx.user() returns the username.

The username can be set from these sources:

  • env var $HGUSER
  • [ui] username in .hgrc.
  • System username as a fallback

The username could be in any of the following formats, and may have extra spaces anywhere:

  • username <email> (the recommended format)
  • username
  • <email>

I've added a parse_user function which supports all the formats, and strips extra spaces.
It could have been written in a couple of lines, but I've kept the function elaborate and used intermediate variables for readability.

How did you test this PR?
I did not.

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

@Niloth-p Niloth-p force-pushed the templates-for-screenshots/hg branch from 29e9d95 to 6939913 Compare July 9, 2025 00:51
@timabbott timabbott merged commit d8cfa66 into zulip:main Nov 18, 2025
13 of 14 checks passed
@timabbott
Copy link
Member

Merged, thanks @Niloth-p!

@Niloth-p Niloth-p deleted the templates-for-screenshots/hg branch November 19, 2025 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants